﻿using System.Collections.Generic;
using Interface;
using SimpleLogicAnalyzer;
using AvrLogicAnalyzer;
using System.IO.Ports;

namespace Framework
{
    public class Framework
    {
        public IList<ILogicAnalyzer> LogicAnalyzers { get; private set; }

        public int SelectedLogicAnalyzerIndex { get; set; }
        public int SelectedCommunicationDeviceIndex { get; set; }

        public Framework(IDictionary<string, string> sampleSettings)
        {
            this.LogicAnalyzers = new List<ILogicAnalyzer>();

            IList<ICommunication> communicationDevices = new List<ICommunication>();
            // Setting for Simple Logic Analyzer
            communicationDevices.Add(new SerialCommunication("COM1", 38400, Parity.None, 8, StopBits.One));
            //communicationDevices.Add(new SerialCommunication("COM1", 115200, Parity.None, 8, StopBits.One));
            //communicationDevices.Add(new SerialCommunication("COM1", 230400, Parity.None, 8, StopBits.One));
            communicationDevices.Add(new VirtualSlaCommunication(38400));

            this.LogicAnalyzers.Add(new AvrAnalyzer(sampleSettings, communicationDevices));
            this.LogicAnalyzers.Add(new LogicAnalyzer(sampleSettings, communicationDevices));

            this.SelectedLogicAnalyzerIndex = 0;
            this.SelectedCommunicationDeviceIndex = 0;
        }
    }
}
